/*
 * Describes a block using 3 Coordinates.
 * 
 */

package tetris.model;

import java.awt.Graphics;
import java.awt.Color;

public class Rotation {
    private Coordinates[] rotation = new Coordinates[3];

    public Rotation(Coordinates one, Coordinates two, Coordinates three){
        this.rotation[0] = one;
        this.rotation[1] = two;
        this.rotation[2] = three;
    }
    
    public Coordinates getPieceOne(){
        return this.rotation[0];
    }
    
    public Coordinates getPieceTwo(){
        return this.rotation[1];
    }

    public Coordinates getPieceThree(){
        return this.rotation[2];
    }

    public void paint(int x, int y, Color color, Graphics g){
        /*
         * Draw shades around each box:
         */
        g.setColor(Color.GRAY);
        g.drawRect(x, y, 20, 20);
        
        g.drawRect(x+rotation[0].getX()*20,
                    y+this.rotation[0].getY()*20,
                    20,
                    20);


        g.drawRect(x+rotation[1].getX()*20,
                    y+this.rotation[1].getY()*20,
                    20,
                    20);

        g.drawRect(x+rotation[2].getX()*20,
                    y+this.rotation[2].getY()*20,
                    20,
                    20);

        /*
         * Draw the boxes:
         */
        g.setColor(color);
        g.fillRect(x, y, 19, 19);
        
        g.fillRect(x+rotation[0].getX()*20,
                    y+this.rotation[0].getY()*20,
                    19,
                    19);

        g.fillRect(x+rotation[1].getX()*20,
                    y+this.rotation[1].getY()*20,
                    19,
                    19);
        
        g.fillRect(x+rotation[2].getX()*20,
                    y+this.rotation[2].getY()*20,
                    19,
                    19);
    }
}
